
package com.engine4cloud.tdf.education.convert;

import com.engine4cloud.tdf.common.core.util.CodeUtils;
import com.engine4cloud.tdf.education.dto.create.EduLearningRecordCreateDTO;
import com.engine4cloud.tdf.education.dto.result.EduLearningRecordResultDTO;
import com.engine4cloud.tdf.education.entity.EduLearningRecordEntity;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;


@Mapper
public interface EduLearningRecordConvert {
    EduLearningRecordConvert INSTANCE = Mappers.getMapper(EduLearningRecordConvert.class);

    EduLearningRecordResultDTO convert(EduLearningRecordEntity s);

    EduLearningRecordEntity createTo(EduLearningRecordCreateDTO s);

    default EduLearningRecordEntity create(EduLearningRecordCreateDTO s, Long tenantId) {
        EduLearningRecordEntity entity = createTo(s);
        entity.setCode(CodeUtils.entrustCode());
        entity.setTenantId(tenantId);
        return entity;
    }
}
